﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Reflection;
using SimpleRest.Core.Routing;

namespace SimpleRest.Core.Extensions.Routes
{
    public class DescriptionRoute : Route
    {
        public readonly Type ServiceType;
        public readonly Configuration Configuration;
        internal readonly Route AssociatedRoute;
        public readonly string RouteUri;
        public readonly string HttpMethod;
        public Pipeline RoutePipeline { get; private set; }

        public DescriptionRoute(Pipeline routePipeline, Configuration configuration, string routeUri, Route associatedRoute)
            : base(routeUri.TrimEnd(new char[] { '/' }), new DescriptionRouteHandler(routePipeline, associatedRoute, configuration))
        {
            this.RoutePipeline = routePipeline;
            this.ServiceType = routePipeline.ServiceType;
            this.Configuration = configuration;
            this.RouteUri = routeUri;
            this.AssociatedRoute = associatedRoute;
            this.HttpMethod = "OPTIONS";
        }
    }
}
